#include "heap.h"

static mt_heap_t test_heap;
static mt_uint32_t heap[40];

void heap_test(void)
{
    void *p1, *p2, *p3;
    mt_uint8_t *p = (mt_uint8_t*)heap;
    
    mt_heap_init(&test_heap, "test_heap", p, p+40*4);
    p1 = mt_heap_alloc(&test_heap, 10);
    p2 = mt_heap_alloc(&test_heap, 30);
    p3 = mt_heap_alloc(&test_heap, 25);
    mt_heap_free(&test_heap, p2);
    p2 = mt_heap_alloc(&test_heap, 12);
    mt_heap_free(&test_heap, p1);
    p1 = mt_heap_alloc(&test_heap, 6);
    mt_heap_free(&test_heap, p3);
    mt_heap_free(&test_heap, p1);
    mt_heap_free(&test_heap, p2);
}
